package com.bree.erp.jsf.view.po;

import java.io.Serializable;

import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;




//import org.apache.log4j.Logger;
import org.primefaces.event.SelectEvent;
import org.primefaces.model.LazyDataModel;

import com.bree.erp.entity.PurchaseOrder;
import com.bree.erp.service.PurchaseOrderService;

public abstract class AbstractPurchaseOrderLazyView implements Serializable {

	private static final long serialVersionUID = 1L;
	
	@EJB
	protected PurchaseOrderService purchaseOrderService;
	
	private PurchaseOrder selectedItem;
	

	public void onRowSelect(SelectEvent event) {
		FacesMessage msg = new FacesMessage("Item Selected",
				((PurchaseOrder) event.getObject()).getId() + "");
		FacesContext.getCurrentInstance().addMessage(null, msg);
	}

	
	/**
	 * @return the selectedItem
	 */
	public PurchaseOrder getSelectedItem() {
		return selectedItem;
	}

	/**
	 * @param selectedItem the selectedItem to set
	 */
	public void setSelectedItem(PurchaseOrder selectedItem) {
		this.selectedItem = selectedItem;
	}
	/**
	 * @return the lazyModel
	 */
	public abstract LazyDataModel<PurchaseOrder> getLazyModel();
}
